﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class url : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        // 用户输入的信息
        string message = this.TextBox1.Text;

        // 应用程序的路径
        string applicationPath = this.Request.ApplicationPath;

        // 计算新路径的前缀
        string prefix = string.Format(
            "{0}/{{X{{{1}}}}}",
            this.Request.ApplicationPath,
            message
            );
        string newPath = this.AppRelativeVirtualPath.Replace("~", prefix);
        this.Response.Redirect(newPath);
    }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        this.Label1.Text = this.Context.Items["message"] as string;
    }
}